package com.qfedu.stussm.controller;

import com.qfedu.stussm.entity.Teacher;
import com.qfedu.stussm.service.intf.TeacherService;
import com.qfedu.stussm.vo.PageBeanVo;
import com.qfedu.stussm.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/teacher/")
public class TeacherController {
    /*
    * 依赖注入
    * */
    @Autowired
    private TeacherService teacherService;
    /*
    * 查询
    * */
    @GetMapping("teacherlist.do")
    @ResponseBody
    public PageBeanVo query(String t_name,int page,int limit){
        return teacherService.selectLikeAll(t_name,page,limit);
    }
    /*
    * 新增
    * */
    @PostMapping("add.do")
    public R add(Teacher teacher){
        return teacherService.add(teacher);
    }
    @PostMapping("delete.do")
    public R delete(int t_id){
        return teacherService.delete(t_id);
    }
    @PostMapping("update.do")
    public R update(Teacher teacher){
        return teacherService.update(teacher);
    }
    @GetMapping("all.do")
    public R all(){
        return teacherService.all();
    }

}
